<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="zh">
<head>
    <meta charset="UTF-8">
    <title>侧边栏片段</title>
    <style>
        /* 您原有的所有CSS样式都保持不变 */
        body {
            font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
            background-color: #f8f9fa;
        }
        .sidebar {
            width: 250px;
            background-color: #2c3e50;
            color: #ecf0f1;
            padding: 25px 0;
            display: flex;
            flex-direction: column;
            box-shadow: 3px 0 10px rgba(0,0,0,0.15);
            position: fixed;
            height: 100%;
            top: 0;
            left: 0;
            z-index: 1000;
            overflow-y: auto;
            transition: width 0.3s ease;
        }
        .sidebar .logo {
            text-align: center;
            margin-bottom: 35px;
            font-size: 1.9em;
            font-weight: 700;
            color: #ffffff;
            padding: 10px 0;
            border-bottom: 1px solid rgba(255,255,255,0.08);
            letter-spacing: 1px;
        }
        .sidebar nav ul {
            list-style: none;
            padding: 0;
            margin: 0;
            flex-grow: 1;
        }
        .sidebar nav ul li {
            margin-bottom: 8px;
        }
        .sidebar nav ul li a {
            display: block;
            padding: 14px 25px;
            color: #ecf0f1;
            text-decoration: none;
            font-size: 1.05em;
            transition: background-color 0.3s ease, color 0.3s ease, transform 0.2s ease;
            border-left: 4px solid transparent;
        }
        .sidebar nav ul li a:hover {
            background-color: #34495e;
            color: #ffffff;
            border-left-color: #3498db;
            transform: translateX(3px);
        }
        .sidebar nav ul li a.active {
            background-color: #3498db;
            color: #ffffff;
            border-left-color: #2980b9;
            font-weight: 600;
        }
        .sidebar .logout {
            padding: 20px 25px;
            text-align: center;
            border-top: 1px solid rgba(255,255,255,0.08);
            margin-top: auto;
        }
        .sidebar .logout a {
            display: block;
            padding: 12px 20px;
            background-color: #e74c3c;
            color: white;
            text-decoration: none;
            border-radius: 6px;
            transition: background-color 0.3s ease, transform 0.2s ease;
            font-size: 1em;
            font-weight: 600;
            box-shadow: 0 2px 5px rgba(0,0,0,0.2);
        }
        .sidebar .logout a:hover {
            background-color: #c0392b;
            transform: translateY(-2px);
            box-shadow: 0 4px 8px rgba(0,0,0,0.25);
        }
        .main-content {
            margin-left: 250px;
            padding: 30px;
            flex-grow: 1;
            background-color: #f8f9fa;
        }
        @media (max-width: 768px) {
            .sidebar {
                width: 100%;
                height: auto;
                position: relative;
                box-shadow: 0 2px 5px rgba(0,0,0,0.1);
                flex-direction: row;
                justify-content: space-around;
                padding: 10px 0;
            }
            .sidebar .logo {
                display: none;
            }
            .sidebar nav ul {
                flex-direction: row;
                justify-content: space-around;
                width: 100%;
            }
            .sidebar nav ul li {
                margin-bottom: 0;
            }
            .sidebar nav ul li a {
                padding: 10px 15px;
                font-size: 0.9em;
                border-left: none;
                border-bottom: 3px solid transparent;
            }
            .sidebar nav ul li a:hover {
                border-left-color: transparent;
                border-bottom-color: #3498db;
            }
            .sidebar nav ul li a.active {
                border-left-color: transparent;
                border-bottom-color: #2980b9;
            }
            .sidebar .logout {
                display: none;
            }
            .main-content {
                margin-left: 0;
                padding-top: 20px;
            }
        }
    </style>
</head>
<body>
<div th:fragment="teacher-sidebar">
    <div class="sidebar">
        <div class="logo">企业培训平台</div>
        <nav>
            <ul>
                <li th:if="${session.loggedInUser != null and session.loggedInUser.role == 'TEACHER'}">
                    <a th:href="@{/teacher/dashboard}"
                       th:classappend="${#httpServletRequest.requestURI.startsWith('/teacher/dashboard') ? 'active' : ''}">
                        <i class="fa fa-dashboard"></i> 仪表盘
                    </a>
                </li>
                <li><a th:href="@{/course/manage}" th:classappend="${#httpServletRequest.requestURI.startsWith('/course') ? 'active' : ''}">课程管理</a></li>
                <li><a th:href="@{/class/manage}" th:classappend="${#httpServletRequest.requestURI.startsWith('/class') ? 'active' : ''}">班级管理</a></li>
                <li><a th:href="@{/student/manage}" th:classappend="${#httpServletRequest.requestURI.startsWith('/student/manage') ? 'active' : ''}">学生管理</a></li>
                <li>
                    <a th:href="@{/practice/manage}"
                       th:classappend="${#httpServletRequest.requestURI.startsWith('/practice') ? 'active' : ''}">实践管理</a>
                </li>
                <li class="menu-item">
                    <a th:href="@{/info/manage}"
                       th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/info') ? 'active' : ''}">
                        <span class="menu-text">资讯管理</span>
                    </a>
                </li>
                <li>
                    <a th:href="@{/qa/browse}"
                       th:classappend="${#httpServletRequest.requestURI.startsWith('/qa') ? 'active' : ''}">问答社区</a>
                </li>

                <li>
                    <a th:href="@{/teacher/comments/manage}"
                       th:classappend="${#httpServletRequest.requestURI.startsWith('/teacher/comments') ? 'active' : ''}">评论管理</a>
                </li>
            </ul>
        </nav>
        <div class="logout">
            <a th:href="@{/logout}">退出登录</a>
        </div>
    </div>
</div>
</body>
</html>